From: Ray Strode Date: Thu, 25 Oct 2012 21:26:17 +0000 (-0400) Subject: recorder: save recorded video as recent item X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~5530 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=eb09f3411497e863a1920a9b3f153bb4791fe3b2;p=gnome-shell.git recorder: save recorded video as recent item Often the first thing a user wants to do after making a recording is post it somewhere. This commit adds the video to recently used items, so that it shows up prominently in open file choosers. https://bugzilla.gnome.org/show_bug.cgi?id=680647 --- diff --git a/configure.ac b/configure.ac index 41fc672f6..9eb3a0278 100644 --- a/configure.ac +++ b/configure.ac @@ -52,7 +52,7 @@ AC_MSG_CHECKING([for GStreamer (needed for recording functionality)]) if $PKG_CONFIG --exists gstreamer-1.0 '>=' $GSTREAMER_MIN_VERSION ; then AC_MSG_RESULT(yes) build_recorder=true - recorder_modules="gstreamer-1.0 gstreamer-base-1.0 x11" + recorder_modules="gstreamer-1.0 gstreamer-base-1.0 x11 gtk+-3.0" PKG_CHECK_MODULES(TEST_SHELL_RECORDER, $recorder_modules clutter-1.0 xfixes gl) else AC_MSG_RESULT(no) diff --git a/src/shell-recorder.c b/src/shell-recorder.c index dbcd0ce78..6a11343a4 100644 --- a/src/shell-recorder.c +++ b/src/shell-recorder.c @@ -11,6 +11,8 @@ #define GST_USE_UNSTABLE_API #include +#include + #include "shell-recorder-src.h" #include "shell-recorder.h" #include "shell-screen-grabber.h" @@ -90,6 +92,7 @@ struct _RecorderPipeline GstElement *pipeline; GstElement *src; int outfile; + char *filename; }; static void recorder_set_stage (ShellRecorder *recorder, @@ -1137,7 +1140,8 @@ get_absolute_path (char *maybe_relative) * be opened. */ static int -recorder_open_outfile (ShellRecorder *recorder) +recorder_open_outfile (ShellRecorder *recorder, + char **outfilename) { const char *pattern; int flags; @@ -1218,8 +1222,12 @@ recorder_open_outfile (ShellRecorder *recorder) { g_printerr ("Recording to %s\n", path); + if (outfilename != NULL) + *outfilename = path; + else + g_free (path); g_string_free (filename, TRUE); - g_free (path); + goto out; } @@ -1257,7 +1265,8 @@ recorder_pipeline_add_sink (RecorderPipeline *pipeline) return TRUE; } - pipeline->outfile = recorder_open_outfile (pipeline->recorder); + pipeline->outfile = recorder_open_outfile (pipeline->recorder, + &pipeline->filename); if (pipeline->outfile == -1) goto out; @@ -1332,6 +1341,8 @@ recorder_pipeline_free (RecorderPipeline *pipeline) if (pipeline->outfile != -1) close (pipeline->outfile); + g_free (pipeline->filename); + g_clear_object (&pipeline->recorder); g_free (pipeline); @@ -1383,6 +1394,10 @@ recorder_pipeline_closed (RecorderPipeline *pipeline) if (pipeline->recorder) { + GtkRecentManager *recent_manager; + GFile *file; + char *uri; + ShellRecorder *recorder = pipeline->recorder; if (pipeline == recorder->current_pipeline) { @@ -1391,6 +1406,15 @@ recorder_pipeline_closed (RecorderPipeline *pipeline) shell_recorder_close (recorder); } + recent_manager = gtk_recent_manager_get_default (); + + file = g_file_new_for_path (pipeline->filename); + uri = g_file_get_uri (file); + gtk_recent_manager_add_item (recent_manager, + uri); + g_free (uri); + g_object_unref (file); + recorder->pipelines = g_slist_remove (recorder->pipelines, pipeline); } diff --git a/src/test-recorder.c b/src/test-recorder.c index caba5dcb7..ec2b05e9e 100644 --- a/src/test-recorder.c +++ b/src/test-recorder.c @@ -3,6 +3,7 @@ #define GST_USE_UNSTABLE_API #include "shell-recorder.h" #include +#include #include /* Very simple test of the ShellRecorder class; shows some text strings @@ -57,6 +58,7 @@ int main (int argc, char **argv) ClutterAnimation *animation; ClutterColor red, green, blue; + gtk_init (&argc, &argv); gst_init (&argc, &argv); if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1;